/**
 * 过滤金额
 */
export const pointBefore = (price, isFormatMoney = false) => {
  let formatMoney = price;
  if (price && price.indexOf('.') != -1) {
    formatMoney = price.substring(0, price.indexOf('.'));
  }
  if (isFormatMoney) {
    // 格式化金额
    const digitsRE = /(\d)(?=(?:\d{3})+$)/g;
    return formatMoney.toString().replace(digitsRE, '$1,');
  } else {
    return formatMoney;
  }
};

export const pointAfter = price => {
  if (price && price.indexOf('.') != -1) {
    return price.substring(price.indexOf('.'), price.length);
  } else {
    return '';
  }
};
